package com.yz.design.strategyDesign;


import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author 广长
 * @version V1.0
 * @className AgilityRequestCenter
 * @description 灵活发佣
 * @date 2021/1/20
 **/
@Scope("prototype")
@Service
@Data
@ApiModel(value = "AgilityRequestCenter", description = "灵活发佣")
public class StrategyCenter {
    @Autowired
    private Map<String, IPaymentRequestService> requestServiceMap;

    /**
     * 发佣服务类
     */
    private IPaymentRequestService requestService;

    /**
     * 发佣类型枚举
     */
    private RequestTypeEnum requestTypeEnum;

    public void init(RequestTypeEnum requestTypeEnum) {
        this.requestTypeEnum = requestTypeEnum;
        this.requestService = this.requestServiceMap.get(requestTypeEnum.getServicePath());
    }

    /**
     * 发佣申请
     *
     * @author: 广长
     * @date: 2021/1/21
     * @return: java.lang.Integer
     */
    public Integer request(StrategyCenter strategyCenter) throws Exception {
        return requestService.request(strategyCenter);
    }


}
